package com.blog.message.api.MQproduct;

import com.blog.common.domain.entity.Comment;
import com.blog.common.domain.entity.Message;
import com.blog.message.api.constant.QueueConstant;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 评论生产者
 * </p>
 *
 * @author Valerie
 * @date 2023/5/27
 **/
@Service
public class CommentProduct {

    @Resource
    private RabbitTemplate rabbitTemplate;

    public void review(Comment comment){
        rabbitTemplate.convertAndSend(QueueConstant.TOPIC_EXCHANGE, "blog.comment.review", comment);
    }

    public void review(Message message){
        rabbitTemplate.convertAndSend(QueueConstant.TOPIC_EXCHANGE, "blog.comment.review", message);
    }
}
